import request from '.'

interface ApiResponse<T = unknown> {
  code: number
  data: T
  message: string
}

export const uploadApi = <T>(data: unknown) => {
  return request.post('/file/upload', data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  }) as Promise<ApiResponse<T>>
}

interface IPublish {
  pubway?: string // 发布方式：imediate立即发布，wait定时发布
  waitPubTime?: string // 定时发布时间
  issueTitle: string
  issueCoverImage: string
  issueDescription: string
  issuePublisher:string
}

export const newsPublishApi = <T>(data: IPublish) => {
  return request.post('/news/publishReleaseList', data) as Promise<ApiResponse<T>>
}
